<?php $view->extend('AnaAgendaBundle::layout.html.php') ?>
<?php $view['slots']->start('_assets') ?>        
        <?php foreach ($view['assetic']->javascripts(array('bundles/js/turno_nuevo.js'),array(),
                   array('output' => 'js/compiled/js.js')) as $url): ?>
            <script src="<?php echo $view->escape($url) ?>"></script>
        <?php endforeach ?>
<?php $view['slots']->stop() ?>  
<div class="row">
    <form role="form " class="form-horizontal" name="form" ng-controller="TurnoNuevoCtrl" ng-submit="submit()" novalidate>
        <div class="form-group" validar>
            <label for="" class="col-sm-2">Paciente</label>
            <div class="col-sm-7 col-md-7">
                <span class="input-group">
                <input type="text" class="form-control" id="turno_paciente" name="tPaciente" ng-model="turno.paciente" placeholder="Nombre o DNI del Paciente" typeahead="paciente as paciente.nombre for paciente in obtenerPacientes($viewValue)" typeahead-loading="cargandoPacientes" required>
                    <span  ng-show="cargandoPacientes" class="input-group-btn">
                        <button type="button" class="btn btn-default" ><i class="glyphicon glyphicon-refresh"></i></button>
                    </span>
                    <span  ng-show="!cargandoPacientes" class="input-group-btn">
                        <button type="button" class="btn btn-default" ><i class="glyphicon glyphicon-search"></i></button>
                    </span>
                </span>
                <span role="alert" class="help-block error" ng-if="form.tPaciente.$error.required">Requerido</span>
                <span class="error" ng-repeat="error in form.errores.paciente.nombre">{{error}}</span>
            </div>
        </div>
        <div class="form-group" validar>
            <label for="turno_jornada" class="col-sm-2">Fecha</label>
            <div class="col-sm-3 col-md-3">
                <span class="input-group">
                <input type="text" class="form-control" datepicker-popup="dd/MM/yyyy" is-open="calendario_jornada" id="turno_jornada" name="tJornada" ng-model="turno.jornada" required>
                <span class="input-group-btn">
                <button type="button" class="btn btn-default"  ng-click="$event.preventDefault();$event.stopPropagation();calendario_jornada=true" ng-init="calendario_jornada=false"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
                </span>
                <span role="alert" class="help-block error" ng-if="form.tJornada.$error.required">Requerido</span>
                <span class="error" ng-repeat="error in form.errores.turno.jornada">{{error}}</span>
            </div>
        </div>
        <div class="form-group" validar>
            <label for="turno_empieza" class="col-sm-2">Empieza</label>
            <div class="col-sm-7 col-md-7">
                <timepicker name="tEmpieza" ng-model="turno.empieza" hour-step="1" minute-step="15" show-meridian="false"></timepicker>
                <p role="alert" class="help-block error" ng-if="form.tEmpieza.$error.required">Requerido</p>
                <p class="error" ng-repeat="error in form.errores.turno.empieza">{{error}}</p>
            </div>
        </div>
        <div class="form-group" validar>
            <label for="turno_termina" class="col-sm-2">Termina</label>
            <div class="col-sm-7 col-md-7">
                <timepicker name="tTermina" ng-model="turno.termina" hour-step="1" minute-step="15" show-meridian="false"></timepicker>
                <p role="alert" class="help-block error" ng-if="form.tTermina.$error.required">Requerido</p>
                <p class="error" ng-repeat="error in form.errores.turno.termina">{{error}}</p>
            </div>
        </div>

        <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid">Guardar</button>
    </form>
</div>

